package com.example.live;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author pengbenlei
 * @date 2024/9/13 13:36
 * @desc
 */

@Configuration
public class WebConfig implements WebMvcConfigurer {
    //解决  No mapping for GET  访问静态资源
    public void addResourceHandlers(ResourceHandlerRegistry registry){
        registry.addResourceHandler("/**")
                .addResourceLocations("classpath:/");

    }
    //http(https)://ip:port/访问本地址
    public void addViewControllers(ViewControllerRegistry registry){
        registry.addViewController("/").setViewName("client");
    }
}
